using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data;
using DTO;

using System.Data;

namespace Business
{
    public class LoaiKhachHangService
    {




		//////////////////////////////////////////////////////////

 		                                                         

		//            Enter code your here                      //

		                                                         

		//////////////////////////////////////////////////////////

       static public DataTable ConvertListLoaiKhachHangDTOToDataTable( List<LoaiKhachHangDTO> lst)
       {
               DataTable dt = new DataTable();
           dt.Columns.Add( "MaLoaiKhachHang");
           dt.Columns.Add( "TenLoaiKhachHang");
           for( int i = 0; i < lst.Count; i ++)
           {
               dt.Rows.Add(
                       lst[i].MaLoaiKhachHang,      
                       lst[i].TenLoaiKhachHang      
                   );
           }
               return dt;
       }
        static public int GetIdentity()
        {
            Data.LoaiKhachHangRepository repo = new LoaiKhachHangRepository();
            return repo.GetIdentity();
        }

        static public int Count()
        {
            return LoaiKhachHangRepository.Count();
        }
        public static bool Them(LoaiKhachHangDTO objDTO)
        {
                LoaiKhachHangRepository repo = new LoaiKhachHangRepository();
                return repo.Them(objDTO);
        }

        public static bool Xoa(int MaLoaiKhachHang, bool XoaKhoaNgoai=false)
        {
              LoaiKhachHangRepository Repo = new LoaiKhachHangRepository();
              return Repo.Xoa(MaLoaiKhachHang,XoaKhoaNgoai);
        }

        public static void CapNhat(LoaiKhachHangDTO objDTO)
        {
            try
            {
                LoaiKhachHangRepository Repo = new LoaiKhachHangRepository();
                Repo.CapNhat(objDTO);
            }
            catch (System.Exception )
            {
            }
        }

        public static List<LoaiKhachHangDTO> LayDanhSach()
        {
            List<LoaiKhachHangDTO> lst = new List<LoaiKhachHangDTO>();
            try
            {
                LoaiKhachHangRepository obj = new LoaiKhachHangRepository();
                lst = obj.LayDanhSach();
            }
            catch (System.Exception )
            {
            }
            return lst;
        }

        static public List<LoaiKhachHangDTO> LayDanhSach(int Start, int Record)
        {
             Data.LoaiKhachHangRepository repo = new LoaiKhachHangRepository();
            return repo.LayDanhSach(Start, Record);
        }

        public static LoaiKhachHangDTO LayTheoMa(int MaLoaiKhachHang)
        {
            LoaiKhachHangDTO objDTO = new LoaiKhachHangDTO();
            try
            {
                LoaiKhachHangRepository Repo = new LoaiKhachHangRepository();
                objDTO = Repo.LayTheoMa(MaLoaiKhachHang);
            }
            catch (System.Exception )
            {
            }
            return objDTO;
        }
    }
}

